<?php
/**
 * @ClassName: PayStatus
 * @Description: 支付状态枚举
 * @author: gydtrade
 * @Date: 2024-09-09 21:54
 * @Version: V1.0.0
 */

namespace app\common\enum;

class PayStatus
{
    const fail = -1;
    const stay = 0;
    const pay = 1;
    const refund_stay = 2;
    const refund_success = 3;
    const refund_fail = 4;
    const part_refund = 5;

    /**
     * 支付状态
     * @param $level
     * @return mixed|string|string[]
     */
    public static function text($level)
    {
        $desc = [
            PayStatus::fail => '支付失败',
            PayStatus::stay => '待支付',
            PayStatus::pay => '已支付',
            PayStatus::refund_stay => '申请退款',
            PayStatus::refund_success => '退款成功',
            PayStatus::refund_fail => '退款失败',
            PayStatus::part_refund => '部分退款',
        ];
        if ($level === true) {
            return $desc;
        }
        return isset($desc[$level]) ? $desc[$level] : $level;
    }

}